package com.nitramf.catchmystream.services.search;

import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.hibernate.search.jpa.Search;

/**
 *
 * @author martinfilliau
 */
@Stateless
@LocalBean
public class IndexManagementService {

    @PersistenceContext
    private EntityManager em;

    /**
     * Rebuild indexes
     * @throws InterruptedException
     */
    public void rebuildIndexes() throws InterruptedException {
        Search.getFullTextEntityManager(em).createIndexer().startAndWait();
    }
}
